package com.fqdf.framework.android.service.downloadservice.helper;


import com.fqdf.framework.android.service.downloadservice.DownloadConstans;
import com.fqdf.framework.android.util.CheckLogicUtil;

import java.io.File;

/**
 * @author 张枭
 * @version V1.0
 * @date 2017/5/3
 * @desc
 */
public abstract class DownloadHelper {

    /**
     * 开始下载实现
     *
     * @param url  需要下载的url
     * @param path 需要保存文件位置的path
     * @return 下载结果
     */
    public DownloadConstans.RESULT downloadFile(String url, String path) {
        if (CheckLogicUtil.isEmpty(url) || CheckLogicUtil.isEmpty(path)) {
            return DownloadConstans.RESULT.PARAMS;
        }
        return downloadFile(url, new File(path));
    }

    abstract DownloadConstans.RESULT downloadFile(String url, File file);
}
